import request from '@/utils/request'

// 获取区域树形数据
export const getRegionTree = () => {
  return request.get('/admin/region/tree')
}

// 获取区域详情  根据id查找一个行政区信息
export const getRegionDetail = (regionId) => {
  return request.get(`/admin/region/${regionId}`)
}

// 新增区域
export const addRegion = (data) => {
  return request.post('/admin/region', data)
}

// 更新区域
export const updateRegion = (data) => {
  return request.put('/admin/region', data)
}

// 删除区域
export const deleteRegion = (regionId) => {
  return request.delete(`/admin/region/${regionId}`)
}

// 修改区域状态
export const changeRegionStatus = (regionId, status) => {
  return request.post(`/admin/region/status/${status}`, null, {
    params: { id: regionId }
  })
}
